package lock;

import java.util.concurrent.locks.Lock;

/**
 * @author liuchaoqun
 * @date 2022/7/5
 * @Description 累加类
 */
public class IncrementData {

    public static int sum = 0;

    public static void lockAndFastIncrease(Lock lock) {

        lock.lock();
            try {
                sum++;
            }finally {
                lock.unlock();
//            }
//        }else {
//            System.out.println(Thread.currentThread().getName()+"没拿到锁");
       }

    }
}
